<?php use User\Model\QuestionnaireModel;?>
<div class="form-group">
    <label class="col-lg-2 col-sm-2 control-label">背景音乐</label>
    <div class="col-lg-6">
        <label class="radio-inline">
            <input type="radio" name="need_music" value="<?php echo QuestionnaireModel::MUSIC_ON?>"
                <if condition="$questionnaire.need_music eq QuestionnaireModel::MUSIC_ON">checked</if>
                onclick="$('.music-part').show()">打开&nbsp;&nbsp;
        </label>
        <label class="radio-inline">
            <input type="radio" name="need_music" value="<?php echo QuestionnaireModel::MUSIC_OFF?>"
            <if condition="$questionnaire.need_music eq QuestionnaireModel::MUSIC_OFF">checked</if>
            onclick="$('.music-part').hide()">关闭
        </label>
    </div>
</div>

<div class="form-group music-part" <if condition="$questionnaire.need_music eq QuestionnaireModel::MUSIC_OFF">style="display:none"</if>>
    <label class="col-lg-2 col-sm-2 control-label">音效文件</label>
    <div class="col-lg-6">
        <input type="hidden" name="background_music" value="{$questionnaire['background_music']}">
        <input type="file" accept="audio/mpeg" onchange="uploadImage(this, ['mp3'], [], 1024, true, false);">
        <p class="help-block">有默认背景音乐，支持上传mp3格式的音频文件，文件小于1M</p>
        <a href="javascript:;" onclick="showAudio();" class="btn btn-default" title="播放"><i class='fa fa-play'></i> 播放</a>
    </div>
</div>
<!--<div class="form-group">-->
    <!--<label class="col-lg-2 col-sm-2 control-label">音效图片</label>-->
    <!--<div class="col-lg-6">-->
        <!--<input type="hidden" name="music_image" value="{$questionnaire['music_image']}">-->
        <!--<input type="file" class="activity-image" onchange="uploadImage(['png'], [50, 50], 500, true, true);" accept="image/gif,image/jpeg,image/jpg,image/png">-->
        <!--<img src="{$questionnaire['music_image']}" class="thumbnail" width="100px" height="100px">-->
        <!--<p class="help-block">有默认的音效图片，可自定义替换，图片为50*50px 的png图片，文件不超过500k</p>-->
    <!--</div>-->
<!--</div>-->
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="music_player" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <audio id="audio_player" src="{$questionnaire['background_music']}" controls="controls" style="width:100%"></audio>
        </div>
    </div>
</div>